﻿<UserControl x:Class="Lessons.Lesson3.Example"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pivot="clr-namespace:ExtendedPivotViewer;assembly=ExtendedPivotViewer"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <UserControl.Resources>
        <Style TargetType="pivot:ExtendedPivotViewer">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Effect">
                <Setter.Value>
                    <DropShadowEffect Opacity="0.3" ShadowDepth="3" BlurRadius="3"/>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Name="InfoPanelStyle" TargetType="Border">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Effect">
                <Setter.Value>
                    <DropShadowEffect Opacity="0.3" ShadowDepth="3" BlurRadius="3"/>
                </Setter.Value>
            </Setter>
            <Setter Property="Width" Value="250"/>
            <Setter Property="Background" Value="#FFf5f7f9"/>
            <Setter Property="BorderBrush" Value="#FFd3d4d4"/>
            <Setter Property="BorderThickness" Value="1"/>
        </Style>
        <Style x:Name="InfoPanelContainerStyle" TargetType="StackPanel">
            <Setter Property="Margin" Value="5"/>
        </Style>
        <Style x:Name="InfoPanelSectionStyle" TargetType="StackPanel">
            <Setter Property="Margin" Value="0,0,0,20"/>
        </Style>
        <Style x:Name="InfoScrollStyle" TargetType="ScrollViewer">
            <Setter Property="BorderThickness" Value="0"/>
        </Style>
        
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="260"/>
        </Grid.ColumnDefinitions>
        <pivot:ExtendedPivotViewer x:Name="pvLesson3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CollectionBackground="{Binding SelectedBackgroundBrush}"
                                   InfoPaneBackground="{Binding InfoPaneBackground}"
                                   ShowInfoPane="{Binding ElementName=cbShowInfo, Path=IsChecked, Mode=TwoWay}"
                                   ShowFilterPane="{Binding ElementName=cbShowFilter, Path=IsChecked, Mode=TwoWay}"
                                   FilterPaneBackground="{Binding FilterPaneBackground}">

        </pivot:ExtendedPivotViewer>

        <Border Grid.Column="1" Style="{StaticResource InfoPanelStyle}">
            <ScrollViewer VerticalScrollBarVisibility="Auto">
                <StackPanel Style="{StaticResource InfoPanelContainerStyle}">

                    <StackPanel Style="{StaticResource InfoPanelSectionStyle}">
                        <TextBlock Text="Set Background"/>
                        <ComboBox x:Name="cbBackground" ItemsSource="{Binding Backgrounds}" SelectedItem="{Binding SelectedBackground, Mode=TwoWay}"/>
                    </StackPanel>

                    <StackPanel Style="{StaticResource InfoPanelSectionStyle}">
                        <TextBlock Text="Info Panel"/>
                        <CheckBox x:Name="cbShowInfo" Content="Show Info Panel" IsChecked="True"/>
                        <TextBlock Text="Background Color"/>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                            <TextBlock Text="A" VerticalAlignment="Center"/>
                            <Slider x:Name="slInfoA" Minimum="0" Maximum="255" Value="{Binding InfoPaneA, Mode=TwoWay}" Width="150"  Margin="5,0,5,0" SmallChange="1"/>
                            <TextBox Width="35" Text="{Binding ElementName=slInfoA, Path=Value, Mode=TwoWay, StringFormat='0'}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                            <TextBlock Text="R" VerticalAlignment="Center"/>
                            <Slider x:Name="slInfoR" Minimum="0" Maximum="255" Value="{Binding InfoPaneR, Mode=TwoWay}" Width="150" Margin="5,0,5,0" SmallChange="1" />
                            <TextBox Width="35" Text="{Binding ElementName=slInfoR, Path=Value, Mode=TwoWay, StringFormat='0'}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                            <TextBlock Text="G" VerticalAlignment="Center"/>
                            <Slider x:Name="slInfoG" Minimum="0" Maximum="255" Value="{Binding InfoPaneG, Mode=TwoWay}" Width="150" Margin="5,0,5,0" SmallChange="1"/>
                            <TextBox Width="35" Text="{Binding ElementName=slInfoG, Path=Value, Mode=TwoWay, StringFormat='0'}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                            <TextBlock Text="B" VerticalAlignment="Center"/>
                            <Slider x:Name="slInfoB" Minimum="0" Maximum="255" Value="{Binding InfoPaneB, Mode=TwoWay}" Width="150" Margin="5,0,5,0" SmallChange="1"/>
                            <TextBox Width="35" Text="{Binding ElementName=slInfoB, Path=Value, Mode=TwoWay, StringFormat='0'}"/>
                        </StackPanel>
                    </StackPanel>

                    <StackPanel Style="{StaticResource InfoPanelSectionStyle}">
                        <TextBlock Text="Filter Panel"/>
                        <CheckBox x:Name="cbShowFilter" Content="Show Filter Panel" IsChecked="True"/>
                        <TextBlock Text="Background Color"/>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                            <TextBlock Text="A" VerticalAlignment="Center"/>
                            <Slider x:Name="slFilterA" Minimum="0" Maximum="255" Value="{Binding FilterPaneA, Mode=TwoWay}" Width="150"  Margin="5,0,5,0" SmallChange="1"/>
                            <TextBox Width="35" Text="{Binding ElementName=slFilterA, Path=Value, Mode=TwoWay, StringFormat='0'}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                            <TextBlock Text="R" VerticalAlignment="Center"/>
                            <Slider x:Name="slFilterR" Minimum="0" Maximum="255" Value="{Binding FilterPaneR, Mode=TwoWay}" Width="150" Margin="5,0,5,0" SmallChange="1" />
                            <TextBox Width="35" Text="{Binding ElementName=slFilterR, Path=Value, Mode=TwoWay, StringFormat='0'}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                            <TextBlock Text="G" VerticalAlignment="Center"/>
                            <Slider x:Name="slFilterG" Minimum="0" Maximum="255" Value="{Binding FilterPaneG, Mode=TwoWay}" Width="150" Margin="5,0,5,0" SmallChange="1"/>
                            <TextBox Width="35" Text="{Binding ElementName=slFilterG, Path=Value, Mode=TwoWay, StringFormat='0'}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                            <TextBlock Text="B" VerticalAlignment="Center"/>
                            <Slider x:Name="slFilterB" Minimum="0" Maximum="255" Value="{Binding FilterPaneB, Mode=TwoWay}" Width="150" Margin="5,0,5,0" SmallChange="1"/>
                            <TextBox Width="35" Text="{Binding ElementName=slFilterB, Path=Value, Mode=TwoWay, StringFormat='0'}"/>
                        </StackPanel>
                    </StackPanel>

                </StackPanel>

            </ScrollViewer>
        </Border>
    </Grid>

</UserControl>
